package com.groovy

import java.sql.Types

class DBTypeConvertUtils {

    static def commonMap = [:]
    static {
        commonMap.put(Types.BIGINT, long.class.getSimpleName());
        commonMap.put(Types.INTEGER, int.class.getSimpleName());
        commonMap.put(Types.SMALLINT, int.class.getSimpleName());
        commonMap.put(Types.TINYINT, int.class.getSimpleName());
        commonMap.put(Types.NUMERIC, int.class.getSimpleName());
        commonMap.put(Types.VARCHAR, String.class.getSimpleName());
        commonMap.put(Types.CHAR, String.class.getSimpleName());
        commonMap.put(Types.DECIMAL, BigDecimal.class.getSimpleName());
        commonMap.put(Types.DATE, java.util.Date.class.getSimpleName());
        commonMap.put(Types.TIMESTAMP, java.util.Date.class.getSimpleName());
    }

    static def getTypeString(type) {
        return commonMap[type]
    }
}
